package org.xxpay.pay.channel.zy2pay;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

@Component
public class Zy2payConfig {

    protected final static String CHANNEL_NAME = "zy2pay"; // 渠道名称

    public static final String RETURN_VALUE_SUCCESS = "OK";    //回调返回状态
    public static final String RETURN_VALUE_ERROR = "error";

    private String memberId;            // 商户编号
    private String payType;             // 通道编码
    private String apiKey;              // 商户私钥
    private String reqUrlHost;          // 请求网关域名

    public Zy2payConfig(){}

    public Zy2payConfig(String payParam) {
        Assert.notNull(payParam, "init "+CHANNEL_NAME+" config error");
        JSONObject object = JSON.parseObject(payParam);
        this.memberId = object.getString("memberId");
        this.payType = object.getString("payType");
        this.apiKey = object.getString("apiKey");
        this.reqUrlHost = object.getString("reqUrlHost");
    }

    public String getMemberId() {
        return memberId;
    }

    public void setMemberId(String memberId) {
        this.memberId = memberId;
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public String getApiKey() {
        return apiKey;
    }

    public void setApiKey(String apiKey) {
        this.apiKey = apiKey;
    }

    public String getReqUrlHost() {
        return reqUrlHost;
    }

    public void setReqUrlHost(String reqUrlHost) {
        this.reqUrlHost = reqUrlHost;
    }
}

